//package com.zxy.furns.web;/**
// * ClassName: RegisterServlet
// * Package: com.zxy.furns.web
// *
// * @Author zxy
// * @Create 2025/3/20 22:05
// * @Version 1.0
// * title:
// * Description:
// */
//
//import com.zxy.furns.entity.Member;
//import com.zxy.furns.service.MemberService;
//import com.zxy.furns.service.impl.MemberServiceImpl;
//
//import javax.servlet.*;
//import javax.servlet.http.*;
//import javax.servlet.annotation.WebServlet;
//import java.io.IOException;
//
//@WebServlet("/registerServlet")
//public class RegisterServlet extends HttpServlet {
//    private MemberService memberService = new MemberServiceImpl();
//
//    @Override
//    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        doPost(req, resp);
//    }
//
//    @Override
//    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        System.out.println("RegisterServlet被调用了...");
//        String username = req.getParameter("username");
//        String password = req.getParameter("password");
//        String email = req.getParameter("email");
//
//        if (!memberService.isExistsUsername(username)) {
//            //如果没有被注册，那么我们们就可以进行注册
//            System.out.println("用户名:" + username + "不存在，可以注册");
//            Member member = new Member(null, username, password, email);
//            if (memberService.register(member)) {
//                System.out.println("注册成功。详细信息为：" + member.getUsername() + ";" + member.getPassword() + ";" + member.getEmail());
//                req.getRequestDispatcher("/views/member/register_ok.jsp").forward(req,resp);
//            }else{
//                System.out.println("注册失败");
//                req.getRequestDispatcher("/views/member/register_fail.jsp").forward(req,resp);
//
//            }
//
//        }else{
//            System.out.println("该用户名"+ username+"已经被注册！");
//            req.getRequestDispatcher("/views/member/login.jsp").forward(req,resp);
//
//        }
//
//
//    }
//}